<?php
/**
 * 用户角色视图模型
 */

namespace Home\Model;

use Think\Model\ViewModel;

Class UserRoleViewModel extends ViewModel
{
     //定义视图表关联关系
    protected $viewFields = array(
        'user' => array(
            'id','username'
        ),
        'user_role' => array(
            '_on' => 'user_role.user_id = user.id'
        ),
        'role' => array(
            'role_name','auth_ids','auth_desc',
            '_on' => 'role.id = user_role.role_id'
        )
    );
}
?>